package com.coocaa.ops.common.core.base.model;

import lombok.Data;

import java.io.Serializable;
import java.util.Map;
import java.util.Objects;

/**
 * @author bijiahao
 * @date : 2019/6/14.
 * @description 基础错误日志模型类
 */
@Data
public class BaseErrLogModel implements Serializable {
    /**
     * 访问Url
     */
    private String url;
    /**
     * 报错类名
     */
    private String className;
    /**
     * 报错方法名称
     */
    private String methodName;

    /**
     * 异常参数
     */
    private Map<String, Object> opParams;
    /**
     * 异常信息-打印日志使用
     */
    private String detailMsg;
    /**
     * 时间戳
     */
    private long timestamp;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        BaseErrLogModel that = (BaseErrLogModel) o;
        return timestamp == that.timestamp && Objects.equals(url, that.url) && Objects.equals(className, that.className) && Objects.equals(methodName, that.methodName) && Objects.equals(opParams, that.opParams) && Objects.equals(detailMsg, that.detailMsg);
    }

    @Override
    public int hashCode() {
        return Objects.hash(url, className, methodName, opParams, detailMsg, timestamp);
    }
}
